package ssm.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import ssm.pojo.Book;
import ssm.service.BookService;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
public class BookController {

    @Autowired
    private BookService bookService;

    /**
     * 返回首页
     * @param session
     * @return
     */
    @RequestMapping("/index")
    public String index(HttpSession session){
        List<Book> bookList = bookService.getAllBook();
        session.setAttribute("bookList",bookList);
        return "index";
    }

}
